<?php
error_reporting( E_ALL&~E_NOTICE );
ini_set( 'display_errors', 'off' );//屏蔽错误和警告提示
include("../../mysql.php");

if(isset($_POST['searchinfo']) and isset($_POST['type']))
{
$type=str_replace("查询","",$_POST['type']);
$searchinfo=$_POST['searchinfo'];
switch ($type) {
   case "悬红":
     $mysql="SELECT * 
FROM `xuanhongs` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
   case "技能":
          $mysql="SELECT * 
FROM `skills` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
   case "装备":
          $mysql="SELECT * 
FROM `equips` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
   case "灯谜":
          $mysql="SELECT * 
FROM `dengmis` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
   case "答题":
          $mysql="SELECT * 
FROM `questions` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
        case "挖宝":
          $mysql="SELECT * 
FROM `wabaos` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
        case "秘境":
          $mysql="SELECT * 
FROM `mjmaps` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
        case "江湖":
          $mysql="SELECT * 
FROM `jhlists` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
        case "地图":
          $mysql="SELECT * 
FROM `maps` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
        case "物品":
          $mysql="SELECT * 
FROM `things` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
     case "清背包":
          $mysql="SELECT * 
FROM `clearbags` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
     case "青龙":
          $mysql="SELECT * 
FROM `qinglongs` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
     case "隐藏npc":
          $mysql="SELECT * 
FROM `hidenpcs` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
     case "奇侠":
          $mysql="SELECT * 
FROM `qixiainfos` 
WHERE `mykey` LIKE '%$searchinfo%'";  
     break;
   default:
     echo "不存在的搜索!";
     exit;
}
$ret=mysql_query($mysql);
$rows=mysql_affected_rows($conn);//获取行数
$colums=mysql_num_fields($ret);//获取列数
echo "共计".$rows."行 ".$colums."列<br/>";
 
echo "<table border='5'><tr>";
for($i=0; $i < $colums; $i++){
$field_name=mysql_field_name($ret,$i);
echo "<th>$field_name</th>";
}
echo "</tr>";
while($row=mysql_fetch_row($ret)){
echo "<tr>";
for($i=0; $i<$colums; $i++){
echo "<td>$row[$i]</td>";
}
echo "</tr>";
}
echo "</table>";
}
else{
    echo "无权访问";
}
?>